﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using System.Xml;
namespace Common
{
    public class Cls_Errorhandling
    {


        public void MainExceptionHandler(object sender, ThreadExceptionEventArgs e)
        {
            if (sender is IErroHandling)
            {
                IErroHandling erroControl = sender as IErroHandling;
                erroControl.ErrorProcessing();
            }
            else
            {
                MessageBox.Show(
                            "应用程序发生了如下的异常信息"
                            + "：" + (char)13
                            + (char)13 + e.Exception.Message
                            + (char)13 + (char)13
                            + "请于系统管理员取得联系！"
                            + (char)13 + (char)13
                            , "异常信息"
                            , MessageBoxButtons.OK
                            , MessageBoxIcon.Error
                            , MessageBoxDefaultButton.Button1
                            , MessageBoxOptions.ServiceNotification);
            }
        }
    }
}
